var modifyPassword_page={};

modifyPassword_page.action = {
    initBody:function () {
        modifyPassword_page.action.bindEvent();
    },
    bindEvent:function () {
        $("#saveBtn").click(function () {
            modifyPassword_page.action.modifyPassword();
            return false;
        });
    },
    modifyPassword:function () {
        var oldPassword = $("#oldPassword").val().trim();
        var newPassword = $("#newPassword").val().trim();
        var newPassword2 = $("#newPassword2").val().trim();
        if (oldPassword=='') {
            AppComm.layer.warm('旧密码不能为空！');
            return;
        }
        if (newPassword=='' || newPassword.length<6) {
            AppComm.layer.warm('请输入6位及以上的新密码！');
            return;
        }
        if (newPassword2=='') {
            AppComm.layer.warm('确认密码不能为空！');
            return;
        }
        if (newPassword!=newPassword2) {
            AppComm.layer.warm('新密码与确认密码不一致！');
            return;
        }
        AppComm.layer.confirm('确定要修改密码吗？',function () {
            AppComm.ajax.post('/userManager/ajax/modifyPassword', {
                oldPassword:oldPassword,
                newPassword:newPassword
            });
        });
    }
};


AppComm.initFrame(modifyPassword_page);